using System;
using System.Collections.Generic;
using System.Linq;

namespace Corelib.Entities
{
	[Table(Name = "dbo.TransactionReceiptDetail")]
	public class Receipt
	{

		#region Private Data Members

		private int  _receiptID;
		private int  _transactionID;
		private int  _donationAccountID;
		private string  _receiptNumber;
		private DateTime  _receiptDate;
		private DateTime  _despatchDate;
		private DateTime  _createDate;
		private DateTime  _modifyDate;

		#endregion

		#region Private "Static" Data Members

		private static readonly string[] _propertyNames = new string[] {
			"ReceiptID",
			"TransactionID",
			"DonationAccountID",
			"ReceiptNumber",
			"ReceiptDate",
			"DespatchDate",
			"CreateDate",
			"ModifyDate",
		};

		#endregion

		#region Constants

		public const int 
			FieldReceiptIDIdx = 0,
			FieldTransactionIDIdx = 1,
			FieldDonationAccountIDIdx = 2,
			FieldReceiptNumberIdx = 3,
			FieldReceiptDateIdx = 4,
			FieldDespatchDateIdx = 5,
			FieldCreateDateIdx = 6,
			FieldModifyDateIdx = 7;

		#endregion

		#region Private instance data members

		private FieldInfo[] _fieldInfo = new FieldInfo[]{
			new FieldInfo(FieldReceiptIDIdx,FieldType.Primitive),
			new FieldInfo(FieldTransactionIDIdx,FieldType.Primitive),
			new FieldInfo(FieldDonationAccountIDIdx,FieldType.Primitive),
			new FieldInfo(FieldReceiptNumberIdx,FieldType.Primitive),
			new FieldInfo(FieldReceiptDateIdx,FieldType.Primitive),
			new FieldInfo(FieldDespatchDateIdx,FieldType.Primitive),
			new FieldInfo(FieldCreateDateIdx,FieldType.Primitive),
			new FieldInfo(FieldModifyDateIdx,FieldType.Primitive),
		};

		#endregion

		#region Public Properties

		[Column(DBType = "int not null")]
		public int ReceiptID
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldReceiptIDIdx,  _receiptID); }
			set {  _receiptID = this.SetValueTypeHelper(_fieldInfo, FieldReceiptIDIdx,  _receiptID, value,  _receiptID == value); }
		}

		[Column(DBType = "int not null")]
		public int TransactionID
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldTransactionIDIdx,  _transactionID); }
			set {  _transactionID = this.SetValueTypeHelper(_fieldInfo, FieldTransactionIDIdx,  _transactionID, value,  _transactionID == value); }
		}

		[Column(DBType = "int not null")]
		public int DonationAccountID
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldDonationAccountIDIdx,  _donationAccountID); }
			set {  _donationAccountID = this.SetValueTypeHelper(_fieldInfo, FieldDonationAccountIDIdx,  _donationAccountID, value,  _donationAccountID == value); }
		}

		[Column(DBType = "nvarchar(19) not null")]
		public string ReceiptNumber
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldReceiptNumberIdx,  _receiptNumber); }
			set {  _receiptNumber = this.SetValueTypeHelper(_fieldInfo, FieldReceiptNumberIdx,  _receiptNumber, value,  _receiptNumber == value); }
		}

		[Column(DBType = "datetime not null")]
		public DateTime ReceiptDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldReceiptDateIdx,  _receiptDate); }
			set {  _receiptDate = this.SetValueTypeHelper(_fieldInfo, FieldReceiptDateIdx,  _receiptDate, value,  _receiptDate == value); }
		}

		[Column(DBType = "datetime null")]
		public DateTime DespatchDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldDespatchDateIdx,  _despatchDate); }
			set {  _despatchDate = this.SetValueTypeHelper(_fieldInfo, FieldDespatchDateIdx,  _despatchDate, value,  _despatchDate == value); }
		}

		[Column(DBType = "datetime not null")]
		public DateTime CreateDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldCreateDateIdx,  _createDate); }
			set {  _createDate = this.SetValueTypeHelper(_fieldInfo, FieldCreateDateIdx,  _createDate, value,  _createDate == value); }
		}

		[Column(DBType = "datetime null")]
		public DateTime ModifyDate
		{
			get { return this.GetHelper(_fieldInfo, _propertyNames, FieldModifyDateIdx,  _modifyDate); }
			set {  _modifyDate = this.SetValueTypeHelper(_fieldInfo, FieldModifyDateIdx,  _modifyDate, value,  _modifyDate == value); }
		}

		#endregion
	}
}
